/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       basic_dialog.h

	$Header: /game/basic_dialog.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef BASIC_DIALOG_H_INCLUDED
#define BASIC_DIALOG_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "bitmap_group_ptr.h"
#include "dialog_box.h"
#include "font_cache.h"
#include "pixel_24.h"
#include "string_vector.h"
#include "text_justification.h"
#include "text_window_ptr.h"

class  t_artifact;
class  t_creature_array;
class  t_creature_stack;
enum   t_creature_type;
enum   t_material;
class  t_material_array;
struct t_skill;
enum   t_spell;
class  t_text_window;
class  t_hero;

// ---------------------------------------------------------
// a dialog box with variable contents: text, several display windows, one or more buttons.
// ---------------------------------------------------------
enum t_vertical_alignment
{
	k_align_top,     // point specifies top coordinate
	k_align_center,  // point specifies center coordinate
	k_align_bottom   // point specifies bottom coordinate
};

class t_basic_dialog : public t_dialog_box
{
public:
	t_basic_dialog( t_window* parent = 0);

	void			add_artifact( t_artifact const& artifact, int amount = 1, bool frame = false );
	void			add_attack( int amount );
	void			add_button( t_button* button );
	void			add_cancel_button();
	void			add_close_button( t_button* button, int result );
	void			add_creature( t_creature_type creature, int amount, bool approximate );
	void			add_creature( t_creature_stack const& creature, bool approximate );
	void			add_creature_icon( t_creature_type creature, const std::string &label = "", const std::string &help = "");
	void			add_creature_icon( t_creature_stack const &creature, const std::string &label = "", const std::string &help = "");
	void			add_creatures( t_creature_array const& creatures, bool approximate );
	void			add_damage( int low_amount, int high_amount, bool percent_sign = false );
	void			add_defense( int amount );
	void           add_display_window( t_window* window, std::string const& label );
	void           add_experience( int amount );
	void           add_experience( int amount, t_hero *hero );
	void           add_experience_icon();
	void		   add_hit_points( int amount, bool percent_sign = false );
	void           add_luck( int amount );
	void           add_mana( int amount );
	void           add_material( t_material material, int amount, bool show_plus_sign = true, bool show_day_text = false );
	void           add_materials( t_material_array const& material, bool show_plus_sign = true );
	void           add_morale( int amount );
	void		   add_movement( int amount);
	void		   add_ok_button();
	void           add_speed( int amount );
	void           add_spell( t_spell spell, bool frame = false );
	void		   add_spell_points( int amount );
	void           add_skill( t_skill const& skill, bool frame = false );
	void           close_click( t_button* button ); // close box, no result.
	void           close_click_result( t_button* button, int result ); // close with a result
	t_screen_point compute_size( bool non_uniform = false ) const;
	void           open( bool non_uniform_size = false );
	void           open( t_screen_point point, bool center_horizontal = true,
		                 t_vertical_alignment vertical_alignment = k_align_center, bool non_uniform_size = false ); // open at a point
	void           open( t_screen_point point, t_screen_rect const& parent_rect,
		                 bool center_horizontal = true,
						 t_vertical_alignment vertical_alignment = k_align_center, bool non_uniform_size = false );
	// open at a point
	void           set_color( t_pixel_24 color );
	void           set_drop_shadow( bool arg, t_pixel_24 color = t_pixel_24(200,200,200));
	void           set_font( t_cached_font font );
	void		   set_title( std::string const& text );
	void           set_text( std::string const& text, t_justification justify = k_justify_center );
protected:
	void add_statistic( std::string const& keyword, int amount, std::string const& name, bool percent_sign = false );
	void arrange_all( t_screen_rect const& rect, bool non_uniform_size, 
					  t_screen_rect const& parent_rect );
	void create_title();

	t_window_list			m_buttons;
	t_pixel_24				m_color;
	t_pixel_24				m_drop_shadow_color;
	bool					m_drop_shadow;
	t_window_list			m_display_windows;
	t_cached_font			m_font;
	t_window_list			m_labels;
	t_text_window_ptr		m_title;
	t_window_ptr			m_title_background;
	t_bitmap_group_ptr		m_title_bitmap;
	t_window_background_ptr	m_text_background;
	t_text_window_ptr		m_text_window;
};

inline void t_basic_dialog::open( t_screen_point point, bool center_horizontal, 
								  t_vertical_alignment vertical_alignment, bool non_uniform_size )
{
	open( point, get_parent()->get_client_rect(), center_horizontal, vertical_alignment, non_uniform_size );
}


#endif // BASIC_DIALOG_H_INCLUDED
